x11: Fix first call to _gdk_x11_keymap_key_is_modifier()
authorBastien Nocera <hadess@hadess.net>
Sun, 19 Feb 2012 15:43:33 +0000 (16:43 +0100)
committerBastien Nocera <hadess@hadess.net>
Sun, 19 Feb 2012 16:18:13 +0000 (17:18 +0100)
_gdk_x11_keymap_key_is_modifier() never tries to set min/max_keycode
if they haven't been set before, meaning that until another function
sets those, all the keys will be seen as non-modifiers.

This causes GdkKeyEvents to be wrongly tagged with "->is_modifier = 0"
when in actual fact the key is a modifier. This fixes keyboard
shortcuts captured with GtkCellRendererAccel in "raw" mode thinking
a modifier without any actual keys is a valid shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=670400

gdk/x11/gdkkeys-x11.c

index a2c5e6eb2b5d6eb861cc48a0de501a981743f979..c2e5e96ef2313aa462ae68ea1a5a8f6fc8c97ff0 100644 (file)
@@ -1490,6 +1490,7 @@ _gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap,
   GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
   gint i;
 
+  update_keyrange (keymap_x11);
   if (keycode < keymap_x11->min_keycode ||
       keycode > keymap_x11->max_keycode)
     return FALSE;